#!/bin/bash
# Exp Symbolic Regression
# Pull argument
if [ -z "$2" ]; then 	# See if number of runs specified
	echo "Run once by default"
	nrun=1
else
    nrun=$2
	echo "Number of runs: "$nrun
fi	
if [ -z "$1" ]; then 	# -n tests to see if the argument is non empty
	echo "Please specify the problem preix"
else
    # define file names
    pfile=params/regression/reg.$1.params
    outdir="."
    ofile=$outdir/output/regression/reg.$1
    objf=$outdir/output/regression/reg.$1.objf
    subjf=$outdir/output/regression/reg.$1.subjf
    #
    let srun=1
    let erun=$nrun+$srun-1
    for i in `seq $srun $erun`;do
        let a=4356+$i
        let b=1234+$i
        date
        java -cp $ECJCP ec.Evolve -file $pfile -p seed.0=$a -p seed.1=$b -p stat.file=$ofile -p myoutput.obj=$objf -p myoutput.subj=$subjf
        mv $ofile $ofile.$i
        mv $objf $objf.$i
        mv $subjf $subjf.$i
    done
fi
#
